﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WindowsFormsApplication1.BLL;
using Millionaire;

namespace WindowsFormsApplication1
{
    public partial class FrmLinhVuc : Form
    {
        LinhVucBLL lvBLL;
        public FrmLinhVuc()
        {
            InitializeComponent();
            lvBLL = new LinhVucBLL();
            LoadDaTaToGridView();
        }

        private void LoadDaTaToGridView()
        {
            dataGridView1.DataSource = lvBLL.GetAll();
        }

        private void btnThem_Click(object sender, EventArgs e)
        {
            LinhVuc lv = new LinhVuc()
            {
                TenLinhVuc = txtLinhVuc.Text
            };
            lvBLL.AddNew(lv);
            LoadDaTaToGridView();
            txtLinhVuc.Clear();
        }
           
    }
}
